﻿using System.Web.Mvc;
using TaskManager.Web.Controls;

namespace TaskManager.Web.Controllers
{
    public class TabController : Controller
    {
        private readonly TabContainer _tabContainer;

        public TabController(TabContainer tabContainer)
        {
            _tabContainer = tabContainer;
        }

        //
        // POST: /Tab/Close/3

        [HttpPost]
        public ActionResult Close(int tabId)
        {
            _tabContainer.Close(tabId);

            return RedirectPermanent(_tabContainer[_tabContainer.ActiveTab].Url);
        }
    }
}
